﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using com.lover.astd.common.config;
using com.lover.astd.common.model;
using com.lover.astd.common;

namespace com.lover.astd.game.ui.server.impl.equipment
{
    public class DailyWeaponServer : LogicServer
    {
        public DailyWeaponServer(MainForm frm)
        {
            _mainForm = frm; ServerName = ConfigStrings.S_DailyWeapon;
            ServerReadableName = ConfigStrings.SR_DailyWeapon;
        }
        public override void renderSettings()
        {
            MainForm frm = _mainForm;
            Dictionary<string, string> conf = getConfig(ServerName);
            frm.chk_dailyweapon_enable.Checked = conf.ContainsKey(ConfigStrings.enabled) && conf[ConfigStrings.enabled].ToLower().Equals("true");
            if (conf.ContainsKey(ConfigStrings.daily) && conf[ConfigStrings.daily] != "") frm.combo_dailyweapon_get.SelectedItem = conf[ConfigStrings.daily];
        }
        public override void saveSettings()
        {
            MainForm frm = _mainForm;
            GameConfig conf = getConfig();
            conf.setConfig(ServerName, ConfigStrings.enabled, frm.chk_dailyweapon_enable.Checked.ToString());
            if (frm.combo_dailyweapon_get.SelectedItem != null)
            {
                conf.setConfig(ServerName, ConfigStrings.daily, frm.combo_dailyweapon_get.SelectedItem.ToString());
            }
        }
        public override void loadDefaultSettings()
        {
            GameConfig conf = getConfig();
            conf.setConfig(ServerName, ConfigStrings.enabled, "true");
            conf.setConfig(ServerName, ConfigStrings.daily, "无敌将军炮");
            renderSettings();
        }
        
    }
}
